--
-- Created by Visual Studio Code.
-- File:  ${moduleName}Box.lua
-- Date: 2021/10/12 17:05:59
-- AUTHOR: ChenCY
-- DESC: 描述
--

require("Logic.${moduleName}.${moduleName}Data")

---@class ${moduleName}Box : ClassType
${moduleName}Box = Class.inheritsFrom("${moduleName}Box")
local _M = ${moduleName}Box

function _M.RegisterEvents()
    -- Event.AddListener(netEventHandler.${GameEvent}, _M.On${GameEvent})
end

--[[
--- 发送游戏事件
function _M.${GameEvent}()
    local mina = MinaClientLua
    local pmsg = ${GameEvent}Msg()
    mina.SendMsg(netEventIDs.${GameEvent}, pmsg)
end

---回调: 游戏事件回调
---@type OnNetMsgHandler
_M.On${GameEvent} = function(serialized, eventMsg)
    local pmsg = ${GameEvent}Msg()
    pmsg:ParseFromString(serialized)
    ${moduleName}Data.On${GameEvent}(pmsg)
    Event.Brocast(eventMsg.id, eventMsg, pmsg)
end
]]


_M.RegisterEvents()
Event.AddListener(GameClientMsg.gDataCache_ResetRoleData, ${moduleName}Data.ResetRoleData)
Event.AddListener(GameClientMsg.gDataCache_OnAfterInitDictData, ${moduleName}Data.InitDictData)
Event.AddListener(GameClientMsg.gDataCache_OnAfterUpdateDictData, ${moduleName}Data.UpdateDictData)

return _M